package cn.itsource.system.service.impl;

import cn.itsource.basic.util.PageResult;
import cn.itsource.system.domain.TMenu;
import cn.itsource.system.domain.TSystemdictionarytype;
import cn.itsource.system.mapper.TMenuMapper;
import cn.itsource.system.query.TMenuQuery;
import cn.itsource.system.query.TSystemdictionarytypeQuery;
import cn.itsource.system.service.TSystemdictionarytypeService;
import cn.itsource.system.mapper.TSystemdictionarytypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 26871
* @description 针对表【t_systemdictionarytype】的数据库操作Service实现
* @createDate 2024-05-06 10:04:15
*/
@Service
public class TSystemdictionarytypeServiceImpl implements TSystemdictionarytypeService{

    @Autowired
    private TSystemdictionarytypeMapper tSystemdictionarytypeMapper;

    @Override
    public void insert(TSystemdictionarytype tSystemdictionarytype) {
        tSystemdictionarytypeMapper.insert(tSystemdictionarytype);

    }

    @Override
    public void delete(Long id) {
        tSystemdictionarytypeMapper.delete(id);

    }

    @Override
    public void update(TSystemdictionarytype tSystemdictionarytype) {
        tSystemdictionarytypeMapper.update(tSystemdictionarytype);

    }

    @Override
    public TSystemdictionarytype selectById(Long id) {

        return tSystemdictionarytypeMapper.selectById(id);
    }

    @Override
    public void save(TSystemdictionarytype tSystemdictionarytype) {
        if (tSystemdictionarytype.getId() == null){
            tSystemdictionarytypeMapper.insert(tSystemdictionarytype);
        }else {
            tSystemdictionarytypeMapper.update(tSystemdictionarytype);
        }

    }

    @Override
    public void patchDelete(List<Long> ids) {
        tSystemdictionarytypeMapper.patchDelete(ids);

    }

    @Override
    public List<TSystemdictionarytype> selectAll() {

        return tSystemdictionarytypeMapper.selectAll();
    }

    @Override
    public PageResult<TSystemdictionarytype> selectByQueryPage(TSystemdictionarytypeQuery tSystemdictionarytypeQuery) {
        Integer total = tSystemdictionarytypeMapper.selectCount(tSystemdictionarytypeQuery);
        List<TSystemdictionarytype> list = tSystemdictionarytypeMapper.selectByQueryPage(tSystemdictionarytypeQuery);
        System.out.println(tSystemdictionarytypeQuery.getKeyword());
        return new PageResult<TSystemdictionarytype>(total,list);
    }

}
